<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="全新晶锐,晶锐,fabia,new fabia,快乐真人售,fabia晶锐" />
	<meta name="description" content="全新晶锐 只为快乐" />
	<title>全新晶锐 只为快乐</title>
	<meta name="viewport">
	<link rel="stylesheet" href="assets/js/libs/fancybox/jquery.fancybox.css">
	<link rel="stylesheet" href="assets/css/main.css">
</head>

<body>
<div class="main">
	<div class="main_inner">
		<div class="header cf">
			<div class="left logo logo_lt"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_lt.png" /></a></div>
			<div class="right logo logo_rt"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_rt.png" /></a></div>
		</div>
		<div class="footer cf">
			<div class="left logo logo_lb"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_lb.png" /></a></div>
			<div class="right logo logo_rb"><a target="_blank" href="http://www.skoda.com.cn/"><img src="assets/images/logo_rb.png" /></a></div>
		</div>
		<div class="loading" id="loading">
			<div class="loading_slide">
				<div class="loading_bar"></div>
				<div class="loading_txt"><span>0%</span>快乐加载中…</div>
			</div>
			<ul class="loading_page">
				<li class="page_item page_item_1"><img src="assets/images/load_1.png" /></li>
				<li class="page_item page_item_2"><img src="assets/images/load_2.png" /></li>
				<li class="page_item page_item_3"><img src="assets/images/load_3.png" /></li>
			</ul>
		</div>
		<div id="main_content" class="main_content">
			<div class="main_content_inner">
				<div id="menu" class="memuboard">
					<div class="menu_tigger"></div>
					<div id="menu" class="menu_inner">
						<ul id="menu_list" class="menu_list">
						</ul>
					</div>
				</div>
				<div class="viewboard viewboard_video cf">
					<div class="video_list_wrap h100">
						<ul class="video_list h100">
							<li class="h100">
								<div class="video_item h100 video_item_1">
									<div class="video_bg"><img src="assets/images/video_bg_1.png" /></div>
									<div class="video_content">
										<div class="model"><img src="assets/images/video_model_1.png" /></div>
										<div class="tags">
											<ul class="tag_list">
												<li class="tag_item">
													<div class="icon icon_1"><a href="index.html"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_2"><a target="_blank" href="http://www.skoda.com.cn/fabia/index.html?open=testDriver"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_3"><a target="_blank" href="http://www.skoda.com.cn/fabia/index.html"></a></div>
												</li>
											</ul>
										</div>
										<div class="video_cont"></div>
									</div>
									<div class="video_voit"><a class="voit"></a><span></span></div>
									<div class="video_share cf">
										<span class="label left">分享给小伙伴：</span>
										<a target="_blank" class="share_icon share_icon_sina left"></a>
										<a class="share_icon share_icon_weixin left"></a>
									</div>
								</div>
							</li>
							<li class="h100">
								<div class="video_item h100 video_item_2">
									<div class="video_bg"><img src="assets/images/video_bg_2.png" /></div>
									<div class="video_content">
										<div class="model"><img src="assets/images/video_model_2.png" /></div>
										<div class="tags">
											<ul class="tag_list">
												<li class="tag_item">
													<div class="icon icon_1"><a href="index.html"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_2"><a target="_blank" href="http://www.skoda.com.cn/fabia/index.html?open=testDriver"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_3"><a target="_blank" href="http://www.skoda.com.cn/fabia/index.html"></a></div>
												</li>
											</ul>
										</div>
										<div class="video_cont"></div>
									</div>
									<div class="video_voit"><a class="voit"></a><span></span></div>
									<div class="video_share cf">
										<span class="label left">分享给小伙伴：</span>
										<a target="_blank" class="share_icon share_icon_sina left"></a>
										<a class="share_icon share_icon_weixin left"></a>
									</div>
								</div>
							</li>
							<!-- <li class="h100">
								<div class="video_item h100 video_item_3">
									<div class="video_bg"><img src="assets/images/video_bg_3.png" /></div>
									<div class="video_content">
										<div class="model"><img src="assets/images/video_model_3.png" /></div>
										<div class="tags">
											<ul class="tag_list">
												<li class="tag_item">
													<div class="icon icon_1"><a href="index.html"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_2"><a href="index.html"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_3"><a href="index.html"></a></div>
												</li>
											</ul>
										</div>
										<div class="video_cont"></div>
									</div>
									<div class="video_voit"><a class="voit"></a><span></span></div>
									<div class="video_share cf">
										<span class="label left">分享给小伙伴：</span>
										<a target="_blank" class="share_icon share_icon_sina left"></a>
										<a class="share_icon share_icon_weixin left"></a>
									</div>
								</div>
							</li> -->
							<li class="h100">
								<div class="video_item h100 video_item_4">
									<div class="video_bg"><img src="assets/images/video_bg_4.png" /></div>
									<div class="video_content">
										<div class="model"><img src="assets/images/video_model_4.png" /></div>
										<div class="tags">
											<ul class="tag_list">
												<li class="tag_item">
													<div class="icon icon_1"><a href="index.html"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_2"><a target="_blank" href="http://www.skoda.com.cn/fabia/index.html?open=testDriver"></a></div>
												</li>
												<li class="tag_item">
													<div class="icon icon_3"><a target="_blank" href="http://www.skoda.com.cn/fabia/index.html"></a></div>
												</li>
											</ul>
										</div>
										<div class="video_cont"></div>
									</div>
									<div class="video_voit"><a class="voit"></a><span></span></div>
									<div class="video_share cf">
										<span class="label left">分享给小伙伴：</span>
										<a target="_blank" class="share_icon share_icon_sina left"></a>
										<a class="share_icon share_icon_weixin left"></a>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>

				<div id="video_btn_prev" class="video_arr arr_left"></div>
				<div id="video_btn_next" class="video_arr arr_right"></div>

			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="assets/js/libs/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/s_code/AppMeasurement.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.easing.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.cookie.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.mousewheel.js"></script>
<script type="text/javascript" src="assets/js/libs/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="assets/js/libs/preloadjs.min.js"></script>
<script type="text/javascript" src="assets/js/libs/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript" src="assets/js/creatjs/easeljs-0.6.0.min.js"></script>
<script type="text/javascript" src="assets/js/creatjs/tweenjs-0.4.0.min.js"></script>
<script type="text/javascript" src="assets/js/creatjs/movieclip-0.6.0.min.js"></script>
<script type="text/javascript" src="assets/js/creatjs/greensock/TweenMax.min.js"></script>
<script type="text/javascript" src="assets/js/apps/main.js"></script>
<script type="text/javascript">
	function QueryString(str){
		var sValue=location.search.match(new RegExp("[\?\&]"+str+"=([^\&]*)(\&?)","i"));
		return sValue?sValue[1]:sValue;
	};
	
	var video_links = [
		'http://events.youku.com/2015/misc/api/video-files.php?vid=XOTM1MDM4MDk2',
		'http://events.youku.com/2015/misc/api/video-files.php?vid=XOTM1MDM2OTY0',
		'http://events.youku.com/2015/misc/api/video-files.php?vid=XOTM1MDM5MzQ4'],
		volume_img = ['assets/images/vo1.png','assets/images/vo2.png'],
		play_img = ['assets/images/play.png','assets/images/pause.png'];
	var loadbl = false;
	function videoStart(){
		if(!loadbl){
			loadvideo();
			$('.video_list').each(function(index,item){
				var sub = $(this).find('>li.h100'),
					item_w = 0,
					index_active = QueryString('page') ? QueryString('page')*1-1 : 0,
					left_p = 0,
					self = this;
				sub.each(function(ind,itm){
					$(itm).css({width:$(window).width()});
					item_w = item_w+$(itm).width();
				});
				var sub_w = item_w/sub.length;
				$(item).css({'width':item_w});
				this.prev = $('#video_btn_prev');
				this.next = $('#video_btn_next');
				//this.prev.hide();
				function bgAnimate(item,x,y){
					$(item).find('.video_bg').animate({
						left:x,
						top: y
					}, {duration: 500, easing: 'swing',complete: function(){
						
					}});
				};
				$(this).find('>li.h100').each(function(){
					var self = this;
					$(this).on('mousemove',function(e){
						var verX = $(e.currentTarget).width()/2,
							verY = $(e.currentTarget).height()/2,
							x = e.clientX,
							y = e.clientY;
						$(self).find('.video_bg').css({
							left:(verX-x)/30
						});
						//top: (verY-y)/20
					});
				});
				var code_arr = [
					'脱口秀视频展开页PC端',
					'说唱视频展开页PC端',
					'美厨娘视频展开页PC端'
				];
				function pushItem(index_active,bl){
					s.pageName=code_arr[index_active]; 
					s.channel=code_arr[index_active];
					s.t();
					if(index_active==0){
						self.prev.hide();
					}else{
						self.prev.show();
					};
					if(index_active>=sub.length-1){
						self.next.hide();
					}else{
						self.next.show();
					}
					if(bl){
						$(item).css({
							marginLeft: -index_active*sub_w
						});
					}else{
						$(item).stop().animate({
							marginLeft: -index_active*sub_w
						}, {duration: 500, easing: 'easeInCubic',complete: function(){
							$(sub[index_active]).addClass("active").siblings().removeClass('active');
						}});
					}
					
					$(item).find('.video_cont').each(function(){
						stopPlay(this);
					});
					//update($(item).find('.video_cont').eq(index_active)[0]);
				};
				pushItem(index_active,true);
				this.next.off('click').on('click',function(e){
					index_active++;
					if(index_active>sub.length-1){
						index_active = sub.length-1;
						return false;
					};
					pushItem(index_active);
				});
				this.prev.off('click').on('click',function(e){
					index_active--;
					if(index_active<0){
						index_active = 0;
						return false;
					};
					pushItem(index_active);
				});
			});
			loadbl = true;
		};
		
	};
	function loadvideo(){
		$('.video_list>li.h100 .video_cont').each(function(index,item){
			var self = this;
			//console.log($(item).width())
			//html
			this.Media = $('<video id="media_'+index+'" width="'+$(item).width()+'" height="'+$(item).height()+'"></video>');
			this.videoContent = $('<div class="video_cont_inner"><div class="video_btn"><img src="assets/images/play_btn.png" /></div><div class="video_wrap"></div><div class="controls"><div class="play_pause_btn"><img src="'+play_img[0]+'" /></div><div class="line"></div><div class="progress"><div class="progressBar"><div class="bufferBar"></div><div class="timeBar"></div></div></div><div class="time_label">00:00</div><div class="line"></div><div class="volume"><img src="'+volume_img[0]+'" /></div><div class="line"></div><div class="screen"><img src="assets/images/screen_btn.png" /></div></div></div>');
			this.Media.appendTo(this.videoContent.find('.video_wrap'));
			this.playing = false;
			this.videoContent.appendTo(item);
			//controls
			this.med = this.Media[0];
			this.ind = index;
			this.med.preload="auto";
			$(item).find('.play_pause_btn').off('click').on('click',function(){ //播放暂停按钮
				update(self);
			});
			$(item).find('.video_btn').off('click').on('click',function(){ //播放暂停按钮
				update(self);
			});
			$(item).find('.volume').off('click').on('click',function(){ //声音控制按钮
				self.med.muted = !self.med.muted;
				if(self.med.muted){
					$(item).find('.volume img').attr('src', volume_img[1]);
				}else{
					$(item).find('.volume img').attr('src', volume_img[0]);
				}
			});
			$(item).find('.screen').off('click').on('click',function(){ //全屏控制按钮
				if(self.med.requestFullScreen){
					self.med.requestFullScreen();
				}else if(self.med.webkitRequestFullScreen){
					self.med.webkitRequestFullScreen();
				}else if(self.med.mozRequestFullScreen){
					self.med.mozRequestFullScreen();
				}else if(self.med.msRequestFullscreen){
					self.med.msRequestFullscreen();
				}else{
					alert('您的浏览器版本过低，请升级浏览器');
				};
			});
			$(item).find('.progressBar').off('click').on('click',function(e){ //点击播放进度条
				var position = e.clientX - $(this).offset().left; //Click pos
				var percentage = 100 * position / $(this).width();
				$(item).find('.timeBar').css({"width":position+'px'});
				self.med.currentTime = self.med.duration * percentage / 100;
			});
			self.Media.on('timeupdate',function(e){
				startBuffer(self);
				timeUpdate(self);
			});
			$(window).resize(function(event) {
				self.Media.width($(self.videoContent).find('.video_wrap').width());
				self.Media.height($(self.videoContent).find('.video_wrap').height());
			});
			$(item).on('mouseover',function(){
				if(self.med.played.length==1){
					$(item).find('.controls').fadeIn(300);
				};
			});
			$(item).on('mouseleave',function(){
				if(self.med.played.length==1){
					$(item).find('.controls').delay(3000).fadeOut(300);
				};
			});
			//for video src
			$.ajax({
				url: video_links[index],
				type: 'GET',
				dataType: 'xml',
				success: function(e){
					var d = $(e).find('mp4 url').eq(0).text();
					self.Media.attr('src',d);
				}
			});
		});
	};
	
	$('.video_list a.voit').each(function(index,item){
		$(item).off('click').on('click',function(e){
			var num;
			if(index==0){
				num = 26;
			}else if(index==1){
				num = 32;
			}else if(index==2){
				num = 40;
			};
			var s=s_gi(s_account);
			s.linkTrackVars="events";
			s.linkTrackEvents="event"+(num+3);
			s.events="event"+(num+3);
			s.tl(this,'o','custom');
			var fbox = $('<div id="fbox" class="voit_content voit_conent_'+index+'"><div class="voit_content_inner"><div class="head"><div class="head_inner"></div></div><div class="content"><div class="tit">填写以下信息，立刻参加幸运抽奖<br />一大波快乐奖品等你拿！</div><div class="form_wrap cf"><div class="form_item cf"><label class="left">姓名：</label><input name="name" id="name" type="text" class="form_text left" /><div class="clear error_dis"><span>请填写姓名！</span></div></div><div class="form_item cf"><label class="left">手机：</label><input name="mobile" id="mobile" type="text" class="form_text left" /><div class="clear error_dis"><span>请填写正确的手机号码！</span></div></div><div class="form_item form_item_radio cf"><label class="left">试驾全新晶锐：</label><input name="testdriver" id="testdriver_1" value="1" checked="checked" type="radio" class="form_radio left" /><span class="left">是</span><input name="testdriver" id="testdriver_2" value="0" type="radio" class="form_radio left" /><span class="left">否</span></div><div class="submit_bar cf"><input name="voit_submit" id="voit_submit" value="确认提交" type="button" class="form_submit" /></div></div></div></div></div>');
			$.fancybox.open(fbox,{
				wrapCSS : 'own_skin',
				padding : 0,
				afterShow: function(e){
					// s.pageName="试驾页面PC端"; 
					// s.channel="试驾页面PC端";
					// s.t();
					var testMobile = function(str){
						var myReg = /^(1(([35][0-9])|(47)|[8][0123456789]))\d{8}$/;
						return(myReg.test(str));
					};
					$('input[name="testdriver"]').click(function(){
						var s=s_gi(s_account);
						s.linkTrackVars="events";
						s.linkTrackEvents="event30";
						s.events="event30";
						s.tl(this,'o','custom');
					});
					$('#voit_submit').click(function(){
						var s=s_gi(s_account);
						s.linkTrackVars="events";
						s.linkTrackEvents="event31";
						s.events="event31";
						s.tl(this,'o','custom');
						var name = $.trim($('input#name').val()),
							mobile = $.trim($('input#mobile').val()),
							choice = $('input[name="testdriver"]:checked').val(),
							form_bl = true;
						$('div.form_item').removeClass('error');
						if(!testMobile(mobile)){
							//alert('请填写正确的手机号码！');
							$('input#mobile').focus().parent().addClass('error');
							form_bl = false;
						};
						if(name===''){
							//alert('请填写姓名!');
							$('input#name').focus().parent().addClass('error');
							form_bl = false;
						};
						if(form_bl){
							$('div.form_item').removeClass('error');
							var setUser = $.ajax({
								type: 'POST',
								url: '../api/index.php/user',
								dataType: 'json',
								data: {uname:name,mobile:mobile,flag:choice,zanid:(index+1)},
								success: function(data){
									alert('个人信息提交成功!');
									$.fancybox.close(fbox);
								}
							})
						}
					});
					
				},
				afterClose: function(){

				}
			});
			
			//http://www.fabiachina.com/api/index.php
			var setZan = $.ajax({
				type: 'POST',
				url: '../api/index.php/zan/'+(index+1),
				dataType: 'json',
				success: function(data){
					function zanHTML(data){
						var d = data['result'];
						$('.fc_list .score_txt').each(function(index,item){
							$(item).find('span.center').text(d[(index)]['count']);
						});
						$('.video_voit span').each(function(index,item){
							$(item).text(d[(index)]['count']);
						});
					};
					var getZan = $.ajax({
						type: 'GET',
						url: '../api/index.php/zan?'+new Date().getTime(),
						dataType: 'json',
						success: function(data){
							zanHTML(data);
						}
					})
				}
			})
			e.preventDefault();
		});
	});
	var startBuffer = function(item) {
		var maxduration = item.med.duration;
		var currentBuffer = item.med.buffered.end(0);
		var percentage = parseInt((currentBuffer/maxduration)*$(item).find('.progressBar').width());
		$(item).find('.bufferBar').css({"width":percentage+'px'});
		if(currentBuffer < maxduration) {
			setTimeout(function(){
				startBuffer(item);
			}, 500);
		}
	};
	
	function timeUpdate(item){
		var currentPos = item.med.currentTime; //Get currenttime
		var maxduration = item.med.duration; //Get video duration
		var percentage = parseInt(currentPos / maxduration *$(item).find('.progressBar').width());
		$(item).find('.timeBar').css({"width":percentage+'px'});
		
		var currentMinute = Math.floor(currentPos / 60)
		if(Number(currentMinute)<10) currentMinute = "0"+currentMinute;
		
		var currentSecond = Math.floor(currentPos % 60)
		if(Number(currentSecond)<10) currentSecond = "0"+currentSecond;

		$(item).find('.time_label').html(currentMinute + ":" + currentSecond);
	}
	function stopPlay(item){
		$('.play_pause_btn img').attr('src', 'assets/images/play.png');
		$('.video_cont .video_btn img').fadeIn();
		item.med.pause();
	};
	function update(item){
		if(item.med.paused){
			var num;
			if(item.ind==0){
				num = 26;
			}else if(item.ind==1){
				num = 32;
			}else if(item.ind==2){
				num = 40;
			};
			var s=s_gi(s_account);
			s.linkTrackVars="events";
			s.linkTrackEvents="event"+num;
			s.events="event"+num;
			s.tl(this,'o','custom');
			//播放状态
			$(item).find('.play_pause_btn img').attr('src', 'assets/images/pause.png');
			$(item).find('.video_btn img').fadeOut();
			item.med.play();
		}
		else{
			//暂停状态
			$(item).find('.play_pause_btn img').attr('src', 'assets/images/play.png');
			$(item).find('.video_btn img').fadeIn();
			item.med.pause();
		}
	};

</script>
</body>
</html>
